package cn.wolfcode.luowowo.hotel.domain;

import java.math.BigDecimal;

import cn.wolfcode.luowowo.article.domain.Destination;
import cn.wolfcode.luowowo.common.domain.BaseDomain;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 酒店
 * @author hslef
 */
@Getter
@Setter
public class Hotel extends BaseDomain {
    /**
     * 度假村
     */
    public static final int TYPE_HOLIDAY = 0;
    /**
     * 客栈
     */
    public static final int TYPE_INN = 1;
    /**
     * 青年旅馆
     */
    public static final int TYPE_YOUTH = 2;
    /**
     * 经济/连锁
     */
    public static final int TYPE_CHAIN = 3;
    /**
     * 公寓
     */
    public static final int TYPE_APARTMENT = 4;
    /**
     * 高端酒店
     */
    public static final int TYPE_HIGH_END = 5;
    /**
     * 奢华酒店
     */
    public static final int TYPE_LUXURY = 6;

    /**
    * 酒店名称
    */
    private String name;

    /**
    * 英文名称
    */
    private String english;

    /**
    * 所在目的地
    */
    private Destination dest;

    /**
    * 住宿类型
    */
    private Integer type;

    /**
    * 封面
    */
    private String covUrl;

    /**
    * 图片
    */
    private String pics;

    /**
    * 品牌
    */
    private String brand;

    /**
    * 地址
    */
    private String location;

    /**
    * 关联主题
    */
    private String themeIds;

    /**
    * 酒店设施
    */
    private String facilityIds;

    /**
    * 酒店服务
    */
    private String serviceIds;

    /**
    * 最低价格
    */
    private Double minPrice;

    /**
    * 评论人数
    */
    private Long commentNum;

    /**
    * 评分
    */
    private Double commentScore;

    /**
     * 简介
     */
    private String info;

    /**
    * 特价
    */
    private Boolean discount;

    /**
    * 等级
    */
    private Integer level;

    public String getTypeName(){
        switch (this.type){
            case Hotel.TYPE_HOLIDAY:return "度假村";
            case Hotel.TYPE_INN:return "客栈";
            case Hotel.TYPE_YOUTH:return "青年旅馆";
            case Hotel.TYPE_CHAIN:return "经济/连锁";
            case Hotel.TYPE_APARTMENT:return "公寓";
            case Hotel.TYPE_HIGH_END:return "高端酒店";
            case Hotel.TYPE_LUXURY:return "奢华酒店";
            default:return null;
        }
    }

    public String[] getPicArr(){
        return this.pics.split(",");
    }

    public Long[] getFacilityIdsArr(){
        String[] idsStr = this.facilityIds.split(",");
        Long[] ids = new Long[idsStr.length];
        for (int i = 0; i < idsStr.length; i++) {
            ids[i] = Long.parseLong(idsStr[i]);
        }
        return ids;
    }

    public Long[] getThemeIdsArr(){
        String[] idsStr = this.themeIds.split(",");
        Long[] ids = new Long[idsStr.length];
        for (int i = 0; i < idsStr.length; i++) {
            ids[i] = Long.parseLong(idsStr[i]);
        }
        return ids;
    }

    public Long[] getServiceIdsArr(){
        String[] idsStr = this.serviceIds.split(",");
        Long[] ids = new Long[idsStr.length];
        for (int i = 0; i < idsStr.length; i++) {
            ids[i] = Long.parseLong(idsStr[i]);
        }
        return ids;
    }


}